package com.company;

import java.util.*;

/**
 * @author jrue
 * @version 1.0
 * @date 2020/3/23 19:03
 */
public class Main61 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String[] split = s.split(",");
        int[] goods = new int[split.length];
        for (int i = 0; i < split.length; i++) {
            goods[i] = Integer.valueOf(split[i]);
        }

        Arrays.sort(goods);
        int res = 0;
        for (int i = goods.length - 1; i >= 0; i--) {
            if (goods[i] % 3 == 0) {
                goods[i] = 0;
                res += goods[i] /3;
            } else {
                for (int j = i - 1; j >= 0; j--) {
                    if ((goods[i] + goods[j]) % 3 == 0) {
                        res += (goods[i] + goods[j]) / 3;
                        goods[j] = 0;
                        goods[i] = 0;
                        break;
                    }
                }
            }
        }

        for (int i = 0; i < goods.length; i++) {
            if (goods[i] <= 3 && goods[i] > 0) {
                res += goods[i] / 3;
            }
        }

        System.out.println(res);
    }

}
